<{include file="Public/top.html" }>
<style>
    .album .img{float:left;width: 32%; height:100px;margin:1px;background-size: 100%;background-repeat: no-repeat}
    .album img{float: right;width:20px}
    span.auditReason{overflow:visible;white-space: normal;color:darkgray;font-size: 10px;line-height:12px}
    textarea{width: 100%;height:100%;}
</style>
	</head>
	<body>



		<div id="warpper">
            <div class="content">
                <div class="location">物品交换</div>
                <{include file="./nav.html" }>
                <div class="filedSet" style="padding-bottom: 0;">
                    <div class="search">
                        <form action="" id="searchForm" method="get" class="ui-form reportForm">
                            <input name="m" type="hidden" value="<{$module}>">
                            <input name="c" type="hidden" value="<{$controller}>">
                            <input name="a" type="hidden" value="<{$action}>">

                            <input name="p" id="page" type="hidden" value="<{$page|default:1}>">
                            <input name="limit" id="limit" type="hidden" value="<{$limit|default:10}>">
                            <input name="ofield" id="ofield" type="hidden" value="<{$ofield}>">
                            <input name="otype"  id="otype"  type="hidden" value="<{$otype}>">

                            <div class="ui-form-item inline-block">
                                <label class="ui-label">物品状态</label>
                                <select name="itemStatus" class="ui-select" style="width:100px;">
                                    <{html_options options=$itemStatus selected=$audit}>
                                </select>
                            </div>

                            <div class="ui-form-item inline-block">
                                <label class="ui-label">物品分类</label>
                                <select name="itemType" class="ui-select" style="width: 100px;">
                                         <{html_options options=$itemType selected=$type}>
                                </select>
                            </div>

                            <div class="ui-form-item inline-block">
                                <button type="button" class="ui-button" onclick="query();">搜索</button>
                            </div>

                        </form>
                    </div>
                </div> 
                             
                
                <!--表格内容-->
                <div class="mainGrid">
                    <table class="ui-table ui-body">
                        <thead>
                        <tr>
                            <th class="pct9">上传时间</th>
                            <th class="pct10">上传用户</th>
                            <th class="pct20">图集</th>
                            <th class="pct9">宝贝描述</th>
                            <th class="pct9">意向说明</th>
                            <th class="pct9">物品状态</th>
                            <th class="pct9">物品分类</th>
                            <th class="pct12 last-col">审核</th>
                        </tr>
                        </thead>
                        <tbody id="listHTML">
                            <{include file="./item_list.html" }>
                        </tbody>
                    </table>
                </div>
                <div class="pagination" id="pagerHTML">
                    <!--描述：分页-->
                    <{include file="Public/page_ajax.html" }>
                </div>
            </div>
		</div>
        <{include file="Public/foot_ajax.html" }>
        <script>
            $(document).ready(function(){
                        $('.album .img').on('mouseover',function (e) {
                            if(e.target.tagName!='DIV'){
                                return;
                            }
                            layer.closeAll();
                            var url=$(e.target).attr('data');

                            layer.tips('<img src="'+url+'" style="width: 300px" >', e.target,
                                    {
                                        tips:[4,'#ffffff'],
                                        area: ['300px', '180px'],
                                        skin:'BoxShadow'
                                    });
                        });
                        $('.img .remove').on('click',function(e){
                            $(e.target).parent().remove()

                        });
                    }
            );

            function adminRefuse(id,obj){
                var reason=prompt("请输入拒绝理由(不少于5个字符)");
                if(reason==null ){
                    return false;
                }
                if( reason.length<5){
                    alert("拒绝理由不可少于5个字符");
                    return false;
                }
                $.post("<{u('adminRefuse')}>",{id:id,reason:reason},function(result){
                    if(result.status==0){
                        query();
                    }
                },'json');

            }
            function adminPass(id,obj){
                if(!confirm('是否执行审核操作')){
                    return false;
                }
                var data=getEditData(id,obj);
                if(data===false){
                    return false;
                }
                $.post("<{u('adminPass')}>",data,function(result){
                    if(result.status==0){
                        query();

                    }
                    layer.msg(result.msg);
                },'json')
            }


            function getEditData(id,obj){
                var $tr=$(obj).parents('tr');
                var itemType=$tr.find("select.itemType").val()
                if(0==itemType){
                    layer.msg("请设置物品的所属分类");
                    return false;
                }
                var album=$tr.find('form').serialize();
                var desc=$tr.find('.desc').val()
                var intention=$tr.find('.intention').val()
                return 'itemType='+itemType+'&'+album+'&desc='+desc+'&intention='+intention+'&id='+id;
            }


        </script>

	</body>
</html>

